package com.webtest.demo;

import static org.testng.Assert.assertTrue;


import org.testng.annotations.Test;

import com.webtest.core.BaseTest;



public class Admin_Login  extends BaseTest{

		@Test 
	public void hdOpen() {
		webtest.open("admin.php/Login/index.html");
		webtest.type("name=name", "admin");
		webtest.type("name=password", "123456");
		webtest.click("xpath=//button[@type='submit']");
		assertTrue(webtest.isTextPresent("退出"));	
	}
	@Test(dependsOnMethods="hdOpen")
	public void testButton1() {
		webtest.click("xpath=//button[@class='btn btn-success']");
	}
	@Test(dependsOnMethods="hdOpen")
	public void testButton2() {
		webtest.click("xpath=//button[@class='btn btn-info']");
	}
	@Test(dependsOnMethods="hdOpen")
	public void testButton3() {
		webtest.click("xpath=//button[@class='btn btn-warning']");
	}
	@Test(dependsOnMethods="hdOpen")
	public void testButton4() {
		webtest.click("xpath=//button[@class='btn btn-danger']");
	}
	@Test(dependsOnMethods="hdOpen")
	public void testStaff() {
		webtest.click("partLink=员工管理");
	}
	@Test(dependsOnMethods="testStaff")
	public void testStaffXiabiao() {
		webtest.click("link=4");
	}
	@Test(dependsOnMethods="testStaff")
	public void testStaffSearch() {
		webtest.type("class=username_search","admin");
		webtest.click("xpath=//button[@class='btn btn-purple btn-sm']");
		assertTrue(webtest.isTextPresent("jiaxinyue"));
	}
	@Test(dependsOnMethods="testStaffSearch")
	public void testStaffEdit() {
		webtest.click("partLink=编辑");
	}
	
	@Test(dependsOnMethods="testStaffSearch")
	public void testStaffEdit1() {
		webtest.type("id=address","123");
		webtest.click("xpath=//button[@type='submit']");
	}
	@Test(dependsOnMethods="testStaffEdit1")
	public void testStaffEditIsOk() {
		webtest.click("partLink=编辑");
		if(webtest.isTextPresent("111")) {
			System.out.println("123");
		}
	}
	
	@Test(dependsOnMethods="hdOpen")
	public void testComment() {
		webtest.click("partLink=评论管理");
	}
	@Test(dependsOnMethods="testComment")
	public void testComment2() {
		webtest.click("partLink=评论列表");
	}
}
}
